erDiagram

    Client ||--|| ClientChannel: is
    Client ||--|{ ClientChannel: has
    Client ||--|| PromiseQueue: has
    Client ||--|| ClientHttp: has
    Client ||--o{ Collection: has
    Client ||--|| ClientSocket: has

    PromiseQueue ||--o{ QueueItem: has

    QueueItem {
        string method
        function resolve
        function reject
        number timeout
    }

    PromiseQueue {
        Map items
    }

    ClientChannel ||--|| EventEmitter2: is

    ClientChannel {
        string name
        Set[string] events
    }

    ClientHttp ||--|| EventSource: has
    ClientHttp ||..|| HttpTransport: connects

    ClientHttp {
        Client client
        string protocol
        string host
        string uri
        EventSource clientEventSource
    }

    ClientSocket ||..|| WebSocketTransport: connects

    ClientSocket {
        Client client
        IsomorphicWebSocket socket
        string protocol
        string uri

        boolean closedGracefully
        boolean ready
        boolean reconnecting
        boolean connecting

        object options
    }

    Server ||--|| ServerChannel: is
    Server ||--|{ ServerChannel: has
    Server ||--|| HttpTransport: has
    Server ||--|| WebSocketTransport: has
    Server ||--|| RedisTransport: has
    Server ||--|{ Method: has

    Method {
        string uuid
        function fn
        boolean isProtected
        function[] middleware
        object schema
        Server server
    }

    ServerChannel ||--|| EventEmitter2: is

    ServerChannel {
        string channelName
        Server server
        Client[] clients
    }

    WebSocketTransport ||--|| IsomorphicWebSocket: has

    HttpTransport ||--|| HttpServer: has

    HttpTransport {
        Server server
        HttpServer server
        HttpTerminator httpTerminator
        Express express
        Map eventSourceClients
    }

